package com.hzjh.base.ext.utils

import com.hzjh.base.utils.other.CheckUtils

object NumberUtils {
    fun formatNumber(number: Int): String {
        return if (number < 1000) number.toString() else (number / 1000.0).toString() + "k"
    }
    fun formatTime(sysTime: String,overTime:String): String {
        if(CheckUtils.isEmpty(sysTime)||CheckUtils.isEmpty(overTime)){
            return ""
        }
        return try {
            val number = (overTime.toLong() - sysTime.toLong())
            val hour = number / (60 * 60)
            val days = hour / 24
            if (days > 0) {
                "${days}d ${hour % 24}h"
            } else {
                "${hour}h"
            }
        }catch (e:Exception){
            ""
        }
    }
}